var weiyou_menu = document.querySelector(".wy_navBar_position");
var wy_menu = document.querySelector(".wy_menu");
var flag = false;
weiyou_menu.onmouseover = function () {
    //如果去去请求过数据，就用原始的数据，不要在发送Ajax了
    if (flag) {

    } else {
        var xhr = new XMLHttpRequest();
        xhr.open("get", "./json/menu.json");
        xhr.send(null);
        xhr.onreadystatechange = function () {
            flag = true;
            if (xhr.readyState == 4 && xhr.status == 200) {
                var data = JSON.parse(xhr.responseText);
                var info = {
                    dataComplate: data
                }
//                console.log(data[1]);
//                console.log(data instanceof Array);
                var html = template("tpl", info);
                console.log(html);
                document.querySelector(".wy_menu_child").innerHTML = html;
            }
        }
    }
    wy_menu.style.display = "block";
}
weiyou_menu.onmouseout = function () {
    wy_menu.style.display = "none";
}
wy_menu.onmouseover = function () {
    wy_menu.style.display = "block";
}
wy_menu.onmouseout = function () {
    wy_menu.style.display = "none";
}